{template 'common/header'}
<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
<ul class="nav nav-tabs">
  <li {if $opp == 'citysetup'}class="active"{/if}><a href="{php echo $this->createWebUrl('citysetup');}">信息库基本设置</a></li>
  <li {if $opp == 'cityclass'}class="active"{/if}><a href="{php echo $this->createWebUrl('cityclass');}">信息库信息分类</a></li>
  <li {if $opp == 'city_overrule'}class="active"{/if}><a href="{php echo $this->createWebUrl('city_overrule');}">信息顶置规则</a></li>
  <li {if $opp == 'citybase'}class="active"{/if}><a href="{php echo $this->createWebUrl('citybase');}">信息库信息管理</a></li>
  <li {if $opp == 'citybanner'}class="active"{/if}><a href="{php echo $this->createWebUrl('citybanner');}">信息库轮播图管理</a></li>
</ul>
</div>
<ul class="nav nav-tabs">
	<li {if $operation == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('cityclass',array('op' =>'display'))}">分类列表</a></li>
	<li{if empty($item['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('cityclass',array('op' =>'post'))}">添加分类</a></li>
	{if !empty($item['id']) &&  $operation == 'post'}<li  class="active"><a href="{php echo $this->createWebUrl('cityclass',array('op' =>'post','id'=>$item['id']))}">编辑分类</a></li>{/if}
</ul>
{if $operation == 'display'}
<div class="panel panel-success">
  <div class="panel-heading">名片通讯录 >信息分类管理</div>
</div>
<div class="main panel panel-default">

	<div class="panel-body table-responsive">

		<table class="table table-hover">

			<thead class="navbar-inner">

				<tr>

					<th style="width:30px;">ID</th>

					<th>显示顺序</th>
                    
                    <th>显示隐藏</th>					

					<th>分类标题</th>

					<th>分类略图</th>

					<th >操作</th>

				</tr>

			</thead>

			<tbody>

				{loop $list $item}

				<tr>

					<td>{$item['id']}</td>

					<td>{$item['porder']}</td>
                    
                    <td>

					

<a id="id{$item['id']}" href="javascript:shen('{php echo $this->createWebUrl('cityclass', array('op' => 'shenhe', 'id' =>$item['id'],'displayk'=>$item['displayk']))}',{$item['id']});" title="{if $item['displayk']==1}隐藏{else}显示{/if}" class="shen btn btn-sm {if $item['displayk']==0} btn-danger{else}btn-success{/if}"><i class="fa">切换</i></a>

             
					</td>				


					<td>{$item['classname']}</td>

					 <td>{if !empty($item['thumb'])}<img src="{$item['thumb']}" width="50" height="50" />{else}<i class="fa fa-picture-o fa-2x"></i>{/if}</td>

					<td style="text-align:left;">

						<a href="{php echo $this->createWebUrl('cityclass', array('op' => 'post', 'id' => $item['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>

						<a href="{php echo $this->createWebUrl('cityclass', array('op' => 'delete', 'id' => $item['id']))}"class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>

					</td>

				</tr>

				{/loop}

			</tbody>

		</table>

		{$pager}

	</div>

</div>

<script>

	require(['bootstrap'],function($){

		$('.btn').hover(function(){

			$(this).tooltip('show');

		},function(){

			$(this).tooltip('hide');

		});

	});
function shen(url,id){

						$.getJSON(url,function(data){

						if(data.a==0){

						$("#id"+id).removeClass('btn-success');

						$("#id"+id).addClass('btn-danger');

						}else if(data.a==1){

						$("#id"+id).removeClass('btn-danger');

						$("#id"+id).addClass('btn-success');

						}

						location.reload();

						})

}
</script>

{elseif $operation == 'post'}



<div class="main">

	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>

		<input type="hidden" name="id" value="{$cityc['id']}" />

		<div class="panel panel-default">

			<div class="panel-heading">

				编辑分类

			</div>

			<div class="panel-body">
            
              <div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" name="porder" class="form-control" value="{$item['porder']}" />

					</div>

				</div>

				<div class="form-group">
              <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>分类标题</label>
               	<div class="col-sm-9 col-xs-12">
                 <input type="text" required class="form-control" name="classname" autocomplete="off" value="{$cityc['classname']}" />
                </div>
              </div>
				<div class="form-group">

               <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>发贴费用</label>
              	<div class="col-sm-9 col-xs-12">
                <div class="input-group">
                <span class="input-group-addon">￥</span>
                 <input type="number" required class="form-control" step="0.01" name="paymoney" value="{$cityc['paymoney']}" />  
                <span class="input-group-addon">元</span>
                 </div>
              <p class="form-control-static" style="color:gray;">为0时认为免费发帖</p>
              </div>
             </div>
             
				<div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">分类图片</label>

					<div class="col-sm-9 col-xs-12">

						{php echo tpl_form_field_image('thumb', $cityc['thumb'])}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='displayk' value=1' {if $cityc['displayk']==1}checked{/if} /> 是
						</label>
						<label class='radio-inline'>
							<input type='radio' name='displayk' value=0' {if $cityc['displayk']==0}checked{/if} /> 否
						</label>
					</div>
				</div>
                 <div class="form-group">
                   <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否需要审核</label>
                <div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='to' value=1' {if $cityc['to']==1}checked{/if} /> 需要审核
						</label>
						<label class='radio-inline'>
							<input type='radio' name='to' value=0' {if $cityc['to']==0}checked{/if} /> 不需要审核
						</label>
					</div>
             </div>
               
			</div>

	

<div class="form-group col-sm-12">

	<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />

	<input type="hidden" name="token" value="{$_W['token']}" />

	</div>

	</form>

</div>




<script language='javascript'>

	function formcheck() {

		if ($("#advname").isEmpty()) {

			Tip.focus("advname", "请填写分类名称!");

			return false;

		}

		return true;

	}

</script>

{/if}

{template 'common/footer'}